package com.blueocean_health.care.management.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.blueocean_health.care.management.domain.base.StaticIncrement;
import com.blueocean_health.care.management.mapper.StaticIncrementMapper;
import com.blueocean_health.care.management.service.StaticIncrementService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * 增值服务 2018年4月19日14:19:05
 * @author wuyanli
 *
 */
@Service
public class StaticIncrementServiceImpl implements StaticIncrementService {
	
	@Autowired
	private StaticIncrementMapper incrementDao;
	
	//用户端静态图片地址
	@Value("${service.address.userstatic}")
	private String serviceAddress;

	@Override
	public PageInfo<StaticIncrement> getIncrementInfoList(Map<String,String> map) {
		int pageSize = Integer.parseInt(map.get("pageSize"));
		int page = Integer.parseInt(map.get("page"));
//		map.put("staticCity", "");
		PageHelper.startPage(page,pageSize);
		List<StaticIncrement> incrementInfoList = incrementDao.getIncrementInfoList(map);
		for (StaticIncrement staticIncrement : incrementInfoList) {
			staticIncrement.setIncrementPic(serviceAddress+staticIncrement.getIncrementPic());
		}
		PageInfo<StaticIncrement> pageInfo = new PageInfo<StaticIncrement>(incrementInfoList);
		return pageInfo;
	}

}
